<#--引入layout文件-->
<#include "/ma/_layout.ftl">

<@head_meta/>
<#--定义该界面需要引入的样式-->
<@head_css>

<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/bootstrap-fileupload.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/jquery.gritter.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/chosen.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/select2_metro.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/jquery.tagsinput.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/clockface.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/bootstrap-wysihtml5.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/datepicker.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/timepicker.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/colorpicker.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/bootstrap-toggle-buttons.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/daterangepicker.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/datetimepicker.css"/>

<link rel="stylesheet" type="text/css" href="${base}/resources/ma/css/multi-select-metro.css"/>

<link href="${base}/resources/ma/css/bootstrap-modal.css" rel="stylesheet" type="text/css"/>
<!-- END PAGE LEVEL STYLES -->
</@head_css>
<@head_script/>

<#--定义该界面需要引入的script-->
<#macro bodyscript>

<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<script src="${base}/resources/ma/js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="${base}/resources/ma/js/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script src="${base}/resources/ma/js/excanvas.min.js"></script>
<script src="${base}/resources/ma/js/respond.min.js"></script>
<![endif]-->
<script src="${base}/resources/ma/js/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="${base}/resources/ma/js/jquery.blockui.min.js" type="text/javascript"></script>
<script src="${base}/resources/ma/js/jquery.cookie.min.js" type="text/javascript"></script>
<script src="${base}/resources/ma/js/jquery.uniform.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->

<!-- BEGIN PAGE LEVEL PLUGINS -->

<script type="text/javascript" src="${base}/resources/ma/js/ckeditor.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/bootstrap-fileupload.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/chosen.jquery.min.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/select2.min.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/wysihtml5-0.3.0.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/bootstrap-wysihtml5.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/jquery.tagsinput.min.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/jquery.toggle.buttons.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/bootstrap-datepicker.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/bootstrap-datetimepicker.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/clockface.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/date.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/daterangepicker.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/bootstrap-colorpicker.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/bootstrap-timepicker.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/jquery.inputmask.bundle.min.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/jquery.input-ip-address-control-1.0.min.js"></script>

<script type="text/javascript" src="${base}/resources/ma/js/jquery.multi-select.js"></script>

<script src="${base}/resources/ma/js/bootstrap-modal.js" type="text/javascript"></script>

<script src="${base}/resources/ma/js/bootstrap-modalmanager.js" type="text/javascript"></script>

<script src="${base}/resources/ma/js/form-components.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script type="text/javascript">
    $(document).on('click', "#submit", function () {
        console.log("验证未添加");

        var jsonforminfo = $("#simple_form").serialize();
        console.log("put请求数据" + jsonforminfo);
        $.ajax({
            url: $("#simple_form").attr("action"),
            type: "put",
            data: jsonforminfo,
            dataType: "json",
            success: function (data) {
//                alert(data.message);
                if (data.status == 'OK') {
                    console.log("更新成功，页面跳转");
                    window.location.href = '${base}/sys/books';
                <#--setTimeout("javascript:location.href='${base}/admin/device'", 5000);-->
                } else {
                    $("#message").css("color", "red");
                    $("#message").text(data.message);
                }
            },
            error: function (error) {
                console.log("error");
            }
        });
    })
</script>
</#macro>
<#--定义jQuery(document).ready();方法需要初始化的函数-->
<#macro script_ready>
FormComponents.init()
</#macro>

<@layout active_id="book" child_active_id="book">

<#--一定要包含于layout内-->
    <@pageheader page_title="图书管理" page_title_small="编辑图书Memo" nav1_title="" nav1_url="" nav2_title="图书管理" nav2_url="" nav3_title="编辑图书" nav3_url=""/>
<!-- BEGIN PAGE CONTENT-->

<div class="row-fluid">

    <div class="span12">

        <!-- BEGIN SAMPLE FORM PORTLET-->

        <div class="portlet box blue">

            <div class="portlet-title">

                <div class="caption"><i class="icon-reorder"></i>编辑图书</div>

                <div class="tools">

                    <a href="javascript:;" class="collapse"></a>

                    <a href="#portlet-config" data-toggle="modal" class="config"></a>

                    <a href="javascript:;" class="reload"></a>

                    <a href="javascript:;" class="remove"></a>

                </div>

            </div>

            <div class="portlet-body form">

                <!-- BEGIN FORM-->

                <form id="simple_form" action="${base}/sys/books" class="form-horizontal" method="put">
                <#--<input type="hidden" name="createDate" value="<#if book.createDate??>${(book.createDate)?string("yyyy-MM-dd")}</#if>"/>-->
                <#--<input type="hidden" name="updateDate" value="<#if book.updateDate??>${(book.updateDate)?string("yyyy-MM-dd")}</#if>"/>-->
                <#--<input type="hidden" name="isDeleted" value="${book.isDeleted!}"/>-->
                    <input type="hidden" name="id" value="${book.id}"/>

                    <div class="control-group">

                        <label class="control-label">图书ISBN</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="isbn" value="${book.isbn}" id="isbn"
                                   placeholder="图书ISBN"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">图书RFID号</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="rfid" value="${book.rfid}" id="rfid"
                                   placeholder="图书RFID号"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>

                    <div class="control-group">

                        <label class="control-label">图书条码</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="barcode" value="${book.barcode}" id="barcode"
                                   placeholder="图书条码"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">图书名称</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="bookname" value="${book.bookname}"
                                   id="bookname"
                                   placeholder="图书名称"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">作者</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="author" value="${book.author}" id="author"
                                   placeholder="作者"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">出版社</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="press" value="${book.press}" id="press"
                                   placeholder="出版社"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">出版时间</label>

                        <div class="controls">

                            <input TYPE="date" class="span6 m-wrap" name="pubdate" value="${book.pubdate}" id="pubdate"
                                   placeholder="出版时间"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">价格</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="price" value="${book.price}" id="price"
                                   placeholder="价格"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">馆区编号或名称</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="libname" value="${book.libname}" id="libname"
                                   placeholder="馆区编号或名称"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">书架编号或名称</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="shiefname" value="${book.shiefname}"
                                   id="shiefname"
                                   placeholder="书架编号或名称"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">层编号或名称</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="layername" value="${book.layername}"
                                   id="layername"
                                   placeholder="层编号或名称"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">创建者</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="createby" value="${book.createby}"
                                   id="createby"
                                   placeholder="创建者"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">更新者</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="updateby" value="${book.updateby}"
                                   id="updateby"
                                   placeholder="更新者"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>
                    <div class="control-group">

                        <label class="control-label">备注信息</label>

                        <div class="controls">

                            <input type="text" class="span6 m-wrap" name="remark" value="${book.remark}" id="remark"
                                   placeholder="备注信息"/>

                            <!--<span class="help-inline">Some hint here</span>-->

                        </div>

                    </div>

                    <div class="control-group">

                        <label class="control-label">删除标志</label>

                        <div class="controls">

                            <#if result.isDeleted=true>
                                <label class="radio">

                                    <input type="radio" name="isDeleted" value="True" checked/>

                                    可借出

                                </label>

                                <label class="radio">

                                    <input type="radio" name="isDeleted" value="False"/>

                                    不可借出

                                </label>
                            <#elseif result.isDeleted=false>
                                <label class="radio">

                                    <input type="radio" name="isDeleted" value="True"/>

                                    可借出

                                </label>

                                <label class="radio">

                                    <input type="radio" name="isDeleted" value="False" checked/>

                                    不可借出

                                </label>
                            </#if>
                        </div>

                    </div>

                    <div class="form-actions">

                        <button type="button" id="submit" class="btn blue">保存</button>

                        <button type="button" class="btn" onclick="history.go(-1)">返回</button>

                    </div>

                </form>

                <!-- END FORM-->

            </div>

        </div>

        <!-- END SAMPLE FORM PORTLET-->

    </div>

</div>

</@layout>